package com.leo.study;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description: 冒牌排序
 * @author: Leo
 * @createDate: 2020/4/15
 * @version: 1.0
 */
public class SortDemo
{
    public static void main(String[] args)
    {
//        int[] numbers = new int[]{1, 5, 8, 2, 3, 9, 4};
//        for (int i = 0; i < numbers.length - 1; i++)
//        {
//            for (int j = 0; j < numbers.length - 1 - i; j++)
//            {
//                if (numbers[j] > numbers[j + 1])
//                {
//                    int temp = numbers[j];
//                    numbers[j] = numbers[j + 1];
//                    numbers[j + 1] = temp;
//                }
//            }
//        }
//        System.out.println("从小到大排序后的结果是:");
//        for (int number : numbers)
//        {
//            System.out.print(number + " ");
//        }

        AtomicInteger integer = new AtomicInteger(5);
        boolean a = integer.compareAndSet(5, 10);
        boolean b = integer.compareAndSet(5, 15);

        System.out.println("a: "+a);
        System.out.println("b: "+b);
    }
}
